package c.h.b.c.a;

import c.f.c.a.e;
import c.h.b.d.a.d;
import com.huawei.hms.iap.entity.InAppPurchaseData;
import com.huawei.hms.iap.entity.OwnedPurchasesResult;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONException;

/* compiled from: lambda */
public final /* synthetic */ class g implements e {
    public final /* synthetic */ c.h.b.d.a.g a;

    public /* synthetic */ g(c.h.b.d.a.g gVar) {
        this.a = gVar;
    }

    public final void onSuccess(Object obj) {
        c.h.b.d.a.g gVar = this.a;
        OwnedPurchasesResult ownedPurchasesResult = (OwnedPurchasesResult) obj;
        ArrayList arrayList = new ArrayList();
        if (!(ownedPurchasesResult == null || ownedPurchasesResult.getInAppPurchaseDataList() == null)) {
            List inAppPurchaseDataList = ownedPurchasesResult.getInAppPurchaseDataList();
            for (int i = 0; i < inAppPurchaseDataList.size(); i++) {
                try {
                    InAppPurchaseData inAppPurchaseData = new InAppPurchaseData((String) inAppPurchaseDataList.get(i));
                    if (inAppPurchaseData.getPurchaseState() == 0) {
                        d dVar = new d();
                        dVar.a = inAppPurchaseData.getProductId();
                        inAppPurchaseData.getPurchaseToken();
                        arrayList.add(dVar);
                    }
                } catch (JSONException unused) {
                }
            }
        }
        gVar.b(arrayList);
    }
}
